package com.cari.oa.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cari.oa.dao.BaseDao;
import com.cari.oa.dao.ReqDao;
import com.cari.oa.domain.ReqEntity;
import com.cari.oa.domain.ReqUserRefEntity;

@Service
@Transactional(rollbackFor = Exception.class)
public class ReqService extends BaseService<ReqEntity> {
	
	@Resource
	private ReqDao reqDao;

	@Override
	public BaseDao<ReqEntity> getDao() {
		return reqDao;
	}
	
	/**
	 * 
	* Title: getPage
	* Description:     分页查询需求
	* @author          hjx 
	* @date            2013-3-12 
	* @param title     标题
	* @param initiator 发起人
	* @param status    状态
	* @param reqType   需求类型
	* @param page    
	* @param size    
	* @return
	 */
	@Transactional(readOnly = true)
    public List<ReqEntity> getPage(String title, String enName, String cnName, String status, String reqType,String sortType,String project, int page, int size) {
    	return reqDao.getPage(title, enName,cnName, status, reqType, sortType,project, page, size);
    }
    
	 /**
     * 
     * Title: getCount
     * Description:
     * @author          hjx 
     * @date            2013-3-12 
     * @param title     标题
	 * @param initiator 发起人
	 * @param status    状态
	 * @param reqType   需求类型
     * @return
     */
	@Transactional(readOnly = true)
    public long getCount(String title,String enName, String cnName, String status, String reqType,String sortType,String project) {
    	return reqDao.getCount(title,enName, cnName, status, reqType, sortType, project);
    }

	/**
	 * 获取本需求的所有负责人
	*@return
	*@author hjx
	*@date 2013-5-10上午11:18:23
	 */
	public List<ReqUserRefEntity> getAllReqPrincipal(String reqId) {
		
		return reqDao.getAllReqPrincipal(reqId);
	}	
}
